#!/bin/bash
#

time=$(date +%s)
date_15=$((time - 15*60))

ps -eo pid,lstart --sort=start_time | while read -r pid sttime;do
   stdate=$(date -d "$sttime" +%s 2>/dev/null)
   if [ $? -eq 0 ] && [ "$stdate" -ge "$date_15" ];then
      echo "15分钟内启动的进程的PID：$pid,进程名称:$(ps -p ${pid} -o comm=)"
   fi
done
